/*var express = require('express');
var router = express.Router();

router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});

module.exports = router;
*/

var express = require('express');
var path = require('path');
var parentPath = path.resolve(__dirname, '..');
var multerUtil = require(path.join(parentPath,'/multerUtil'));
var router = express.Router();

var upload = multerUtil.array('fileList');

router.post('/upload',function (req, res) {
	//res.json(req.body)
	upload(req,res, function (err) {
		if (err) {
			res.send('error');
		} else{
			res.json(req.files[0].filename);
		}
	})
});

module.exports = router;
